package cn.shyouchi.wuguanjia.android.ui.event.checknum;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.impl.ModuleItemClickListener;

/**
 * Created by Eenie on 2016/12/23 at 17:37
 * Email: 472279981@qq.com
 * Des:
 */

public class CheckNumLineAdapter extends BaseQuickAdapter<CheckNumLineEntity.ResultMessageBean, BaseViewHolder> {

    ModuleItemClickListener mModuleItemClickListener;



    public CheckNumLineAdapter(List<CheckNumLineEntity.ResultMessageBean> data, ModuleItemClickListener listener) {

        super(R.layout.item_event_check_num_line_layout, data);
        mModuleItemClickListener = listener;

    }

    @Override
    protected void convert(BaseViewHolder holder, final CheckNumLineEntity.ResultMessageBean entity) {


        holder.setText(R.id.tv_position, String.valueOf(holder.getAdapterPosition() + 1));

        holder.setText(R.id.tv_line_name, entity.getName());


        holder.getView(R.id.item_layout).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mModuleItemClickListener.moduleItemClick(entity);
            }
        });
        holder.getView(R.id.btn_edit).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mModuleItemClickListener.moduleItemLongClick(entity);
            }
        });
        holder.getView(R.id.btn_del).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mModuleItemClickListener.onDel(entity);
            }
        });

    }


}
